package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(100);"`
	Password string `gorm:"type:varchar(100);"`
	Mobile   string `gorm:"type:char(11);"`
}

func (u *User) FindUserByUsername(username string) (user *User, err error) {
	err = DB.Where("username=?", username).Find(&user).Limit(1).Error
	if err != nil {
		return nil, err
	}
	return user, nil
}
